package day13;

import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;

/**
 * @author tongchen
 * @create 2023-03-20 20:05
 */
public class Main1 {
   static HashSet<LinkedList<Integer>> lists = new HashSet<>();
    public static int count=0;
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int num=scanner.nextInt();
        int[]arr=new int[num];
        for (int i = 0; i <num ; i++) {
            arr[i]=scanner.nextInt();
        }
        //使用哈希表排除重复结果
        Arrays.sort(arr);
        LinkedList<Integer> list = new LinkedList<>();
        process(0, 0, 0, arr,list);
        System.out.println(lists.size());
    }
    //创建递归方程
    public static void process(int index,int add ,int mul,int[]arr,LinkedList<Integer>list){
        //递归出口
        if(index>=arr.length){
            return;
        }
        //符合条件的情况
        if(add>mul){
            lists.add(list);
        }
        //递归
        process(index+1, add, mul, arr,list);
        add+=arr[index];
        mul*=arr[index];
        list.add(arr[index]);
        process(index+1, add, mul, arr,list);
        list.remove(arr[index]);
    }
}
